package ru.st.selenium.pages;


import static org.openqa.selenium.support.ui.ExpectedConditions.*;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;

public class AddFilmPage extends InternalPage {
	
	public AddFilmPage (PageManager pages) {
		super(pages);
	}
	
  @FindBy(name = "imdbid")
	private WebElement imdbidField;
	
  @FindBy(name = "name")
  private WebElement nameField;
  
  @FindBy(name = "year")
  private WebElement yearField;
  
  @FindBy(name = "notes")
  private WebElement notesField;
  
  @FindBy(name = "submit")
  private WebElement submitButton;
  
  public AddFilmPage setImdbidField(String text) {
	  imdbidField.sendKeys(text);
	    return this;
	  }

	  public AddFilmPage setYearField(String text) {
		  yearField.sendKeys(text);
	    return this;
	  }

	  public AddFilmPage setNotesField(String text) {
		  notesField.sendKeys(text);
	    return this;
	  }
	  
	  public AddFilmPage setNameField(String text) {
		  nameField.sendKeys(text);
	    return this;
	  }
	  public void clickSubmitButton() {
		  submitButton.click();
		   }

	  public AddFilmPage ensurePageLoaded() {
		    super.ensurePageLoaded();
		    wait.until(presenceOfElementLocated(By.id("updateform")));
		    return this;
		  }   
	  
}
